﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Assignment_4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string time = DateTime.Now.ToString().Substring(10, 10);
            lblTimeNow.Text = "Time: " + time;
        }

        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {

        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                MessageBox.Show("Please insert Name", "Attendance of Student", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtName.Focus();
                return;
            }

            if (mskRollNo.Text == "" || mskRollNo.Text.Trim().Length < 3)
            {
                MessageBox.Show("Please correct Roll Number (3 digits)", "Attendance of Student", MessageBoxButtons.OK, MessageBoxIcon.Error);
                mskRollNo.Focus();
                return;
            }

            string name = txtName.Text.Trim();
            string rollNo = mskRollNo.Text;
            string date = dtpDate.Text.ToString();
            string atten = rdbPresent.Checked ? "Present" : "Absent";

            string infor = "";
            infor += "Name: " + name;
            infor += "\nRoll Number: " + rollNo;
            infor += "\nDate: " + date;
            infor += "\nAttendance: " + atten;

            MessageBox.Show(infor, "Attendance of Student", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
    }
}
